home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Draw / TRootObj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-05  |  2.1 KB  |  104 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TRootObj.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. /* See the files "=How to write your app" and "=Using TreeObj.c" for information
  20. ** on this function. */
  21.  
  22.  
  23.  
  24. /*****************************************************************************/
  25.  
  26.  
  27.  
  28. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  29. #include "App.protos.h"        /* Get the prototypes for the application.        */
  30.  
  31. #ifndef __OSEVENTS__
  32. #include <OSEvents.h>
  33. #endif
  34.  
  35. #ifndef __OSUTILS__
  36. #include <OSUtils.h>
  37. #endif
  38.  
  39. #ifndef __QUICKDRAW__
  40. #include <Quickdraw.h>
  41. #endif
  42.  
  43. #ifndef __STRING__
  44. #include <String.h>
  45. #endif
  46.  
  47. #ifndef __TREEOBJ2__
  48. #include "TreeObj2.h"
  49. #endif
  50.  
  51. #ifndef __UTILITIES__
  52. #include "Utilities.h"
  53. #endif
  54.  
  55.  
  56.  
  57. #pragma segment DrawObjects
  58. long    TRootObj(TreeObjHndl hndl, short message, long data)
  59. {
  60.     short    fileRefNum;
  61.     char    *cptr;
  62.  
  63.     switch (message) {
  64.         case FREADMESSAGE:
  65.             fileRefNum = data;
  66.             return(ReadTreeObjData(hndl, fileRefNum));
  67.             break;
  68.  
  69.         case FWRITEMESSAGE:
  70.             fileRefNum = data;
  71.             return(WriteTreeObjData(hndl, fileRefNum));
  72.             break;
  73.  
  74.         case HREADMESSAGE:
  75.             return(HReadTreeObjData(hndl, (Handle)data));
  76.             break;
  77.  
  78.         case HWRITEMESSAGE:
  79.             return(HWriteTreeObjData(hndl, (Handle)data));
  80.             break;
  81.  
  82.         case VHMESSAGE:
  83. #if VH_VERSION
  84.             cptr = ((VHFormatDataPtr)data)->data;
  85.             ccatchr(cptr, 13, 2);
  86.             VHRootInfo(hndl, cptr);
  87.             ccat   (cptr, "  $08: numSelected = ");
  88.             ccatdec(cptr, mDerefRoot(hndl)->numSelected);
  89.             ccatchr(cptr, 13, 2);
  90.             VHFileRecInfo(hndl, cptr);
  91.             return(true);
  92. #endif
  93.             break;
  94.  
  95.         default:
  96.             break;
  97.     }
  98.  
  99.     return(noErr);
  100. }
  101.  
  102.  
  103.  
  104.